package cn.wolfcode.trip.api.controller;

import cn.wolfcode.trip.base.domain.NewsPage;
import cn.wolfcode.trip.base.query.NewsPageQueryObject;
import cn.wolfcode.trip.base.service.INewsPageService;
import cn.wolfcode.trip.base.util.JsonResult;
import com.github.pagehelper.PageInfo;
import jdk.nashorn.internal.objects.annotations.Getter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;



@RestController
@RequestMapping("newsPage")
public class NewsPageController {

    @Autowired
    private INewsPageService newsPageService;

    //查询所有的日报
    @GetMapping
    public PageInfo query(NewsPageQueryObject qo){
        qo.setPageSize(0);
        return newsPageService.query(qo);
    }

    //index下的热门日报,判断由页面传过来的状态,1是大热门,2是普通发布
    @GetMapping("listByLine")
    public PageInfo query1(NewsPageQueryObject qo){
        return newsPageService.query(qo);
    }

    @GetMapping("{id}/newsPageContent")
    public NewsPage getPageById(@PathVariable Long id) {
        return newsPageService.get(id);
    }

}
